home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / ispell-3.1.18bin / interfaces / guispell-1.1 / rexx / ced / spell.ced < prev    next >
Text File  |  1995-09-21  |  2KB  |  106 lines

  1. /*  
  2.  *  Spell.ced ... ARexx Program to spell check a file while in CED!
  3.  *  Requires ISpell version 2.1ljr with ARexx Server mode.
  4.  *  Started: LJR  ?
  5.  *  Updated for CED v2.0: LJR  Tue Jan 23 04:22:16 1990
  6.  *  Updated for OS 2.04: LJR  Sat Nov 23 17:40:36 1991
  7.  *  Copyright © 1990, 1991, 1992  Loren J. Rittle
  8.  *  Use as you will, just document your changes and keep my copyright
  9.  *  notice intact.
  10.  *
  11.  *  Loren J. Rittle
  12.  *  rittle@comm.mot.com
  13.  */
  14.  
  15. options results
  16.  
  17. status 21
  18. buffername = result
  19. errorname = buffername || '.err'
  20. whereclip = address() || 'where' || buffername
  21.  
  22. where = getclip(whereclip)
  23. if where ~== "" then do
  24.   if open('err', 'ram:@@'errorname,'r') = 0 then do
  25.     okay1 'Can''t open ram:errorfile!'
  26.     exit 0
  27.   end
  28.   seek('err', where, 'Begin')
  29.   word = readln('err')
  30.   if word = "" then do
  31.     close('err')
  32.     okay1 "No more errors were found!"
  33.     address command 'delete ram:@@'buffername 'ram:@@'errorname
  34.     setclip(whereclip)
  35.     exit 0
  36.   end
  37.  
  38.   address 'IRexxSpell' check word
  39.   line = result
  40.   parse var word '&' choices
  41.  
  42.   search for... word 0 0 1 1
  43.   if choices =  "" then
  44.     okay1 "Nothing good found for" word||"."
  45.   else
  46.     okay1 "Try"||choices||"0a"x||"in place of" word||"."
  47.   where = seek('err', 0, 'Current')
  48.   call setclip whereclip, where
  49.   close('err')
  50.  
  51.   exit 0
  52. end
  53.  
  54. if ~show(ports, 'IRexxSpell') then
  55.   do
  56.     address command 'run <nil: >nill: ispell -r >nil: <nil:'
  57.     address command waitforport 'IRexxSpell'
  58.   end
  59.  
  60. beg of file
  61. mark block
  62. 'end of file'
  63. copy block
  64. 'save block to file...' "ram:@@"buffername
  65. mark block
  66. left
  67. copy block
  68. beg of file
  69.  
  70. address 'IRexxSpell' filecheck "ram:@@"buffername
  71. r = result
  72. if pos('Error', r) ~= 0 then do
  73.   okay1 'ISpell' r
  74. end
  75.  
  76. address command copy r "ram:@@"errorname
  77. address command delete r
  78. if open('err', 'ram:@@'errorname,'r') = 0 then do
  79.   okay1 'Can''t open ram:errorfile!'
  80.   exit 0
  81. end
  82.  
  83. word = readln('err')
  84. if word = "" then do
  85.   close('err')
  86.   okay1 "No errors were found!"
  87.   address command 'delete ram:@@'buffername 'ram:@@'errorname
  88.   setclip(whereclip)
  89.   exit 0
  90. end
  91.  
  92. address 'IRexxSpell' check word
  93. line = result
  94. parse var word '&' choices
  95.  
  96. search for... word 0 0 1 1
  97. if choices =  "" then
  98. okay1 "Nothing good found for" word||"."
  99. else
  100. okay1 "Try"||choices||"0a"x||"in place of" word||"."
  101.  
  102. where = seek('err', 0, 'Current')
  103. call setclip whereclip, where
  104. close('where')
  105. close('err')
  106.